﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Product.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Site.ViewModels.DealDetailsModels>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%=Model.Product!=null? Html.Encode(Model.Product.Name):string.Empty %>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MetaContent" runat="server">
    <meta name="page-topic" content='<%=Html.Encode(Model.Product.Name) %>' />
    <meta name="title" content="<%=Html.Encode(Model.Product.Name) %> - Chọn quà, mua quà, tặng quà online muaqua.vn" />
    <meta name="keywords" content="<%=Model.Product.MetaKeyword %>" />
    <meta name="description" content="<%=Model.Product.MetaDescription %>" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div>
    <h2><%=Html.Encode(Model.Product.Name) %></h2>  
    <div class="bg-x mar_t">
      <div class="pad">
   	        <p><%=Html.Encode(Model.Product.Summary) %></p>
            <div class="sfam-l">
        	    <div class="pad">
                    <div><strong>Giá chỉ:</strong></div>
                  <div class="price_detail mar_t"><%=string.Format("{0:0,0}",Model.Product.UnitPrice) %> ₫</div>
                  <form action="/deal/create" method="post" name="siteForm" id="siteForm">
                    <%=Html.Hidden("hdProductID",Model.Product.ID) %>
                    <%if (Model.Product.EndDate.HasValue && Model.Product.EndDate.Value > DateTime.Now)
                      {   %>
                        <div class="btn_buy"><a href="#" onclick="document.siteForm.submit();"><img src="/Images/mq/btn_order.gif" /></a></div>
                    <%}
                      else { %>
                      <div class="btn_buy"><a href="#" onclick="return showExpire();"><img src="/Images/mq/btn_order.gif" /></a></div>
                      <%} %>
                  </form>
                  <script type="text/javascript">
                      function showExpire() {
                          alert("Rất tiếc! Đã quá thời hạn bán sản phẩm.");
                          return false;
                      }                
                 </script>
                </div>
              <div class="bg_tt" align="center">
           	      <div class="dt-1">
               	      <div><strong>Giá gốc</strong></div>
                        <div><%=string.Format("{0:0,0}",Model.Product.UnitOldPrice) %> ₫</div>
                  </div>
                    <div class="dt-2">
                	    <div><strong>Giảm</strong></div>
                        <div><%=string.Format("{0:0,0}", Model.Product.DiscountPercent) %>%</div>
                    </div>
                    <div class="dt-3">
                	    <div><strong>Tiết kiệm</strong></div>
                        <div><%=string.Format("{0:0,0}",Model.Product.DiscountValue) %> ₫</div>
                    </div>
                    <div class="clear"></div>
              </div>
              <br />
                 <%var buyer = Model.Product.OrderDetails.Where(e => e.Order.TypeID == SDT.Lib.Common.OrderType.Deal).ToList();
                   var counter = buyer.Count > 0 ? buyer.Sum(e => e.Quantity) : 0; %>
              <div align="center"><span class="t_note"><%=counter%></span> phiếu đã bán &nbsp;|&nbsp; Còn <span class="t_note"><%=Model.Product.MaxVoucher.HasValue && Model.Product.MaxVoucher.Value-counter>0? (Model.Product.MaxVoucher.Value- counter).ToString():"0"%></span> phiếu</div>
                <div class="clock mar_t"><img src="/images/mq/clocl.gif" /></div>
                <div class="time-remain mar_t">
            	   <%if (Model.Product.EndDate.HasValue && Model.Product.EndDate.Value > DateTime.Now)
                   {    %>
            	    <div><strong>Thời gian còn lại</strong></div>
                    <div><%=SDT.Lib.Common.Utils.GetCountDownDate(DateTime.Now, Model.Product.EndDate)%></div>
                    <%}
                   else
                   { %>
                    <div>
                        Rất tiếc! Đã quá thời hạn bán sản phẩm.
                    </div>
                    <%} %>
                </div>
                <div class="clear"></div>
            </div>
          <div class="sfam-r">
        	     <% string imgPath = (Model.Product.ImagePath != null && Model.Product.ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(Model.Product.ID, 400, 290, Model.Product.ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo; %>
                    <img src="<%=imgPath %>" title="<%=Model.Product.Name %>" alt="<%=Model.Product.Name %>" width="444px"
                        height="290px" />
            </div>
            <div class="clear"></div>
      </div>
      	
    </div>			
    <div class="dt-ddnoibat" >
 		    <div class="bar-top"><div class="dt-tit-dd">Đặc điểm nổi bật</div></div>
            <div class="bar-mid">
        	    <div class="dt-list-cnt">
                    <pre style="margin: 0px 5px 0 5px;"><%=Model.Product.Highlights %></pre>                    
                </div>
            </div>
            <div class="bar-bot"></div>
    </div>
    <div class="dt-dksd" >
	    <div class="bar-top"><div class="dt-tit-dd">Điều kiện sử dụng</div></div>
            <div class="bar-mid">
        	    <div class="dt-list-cnt">
                   <pre style="margin: 0px 5px 0 5px;"><%=Model.Product.Conditions %></pre>
                </div>
            </div>
            <div class="bar-bot"></div>
    </div>
    <div class="clear"></div><br />
    <h3><strong>Chi tiết sản phẩm</strong></h3>
    <div class="mar_t">
        <%=Model.Product.Description %>
    </div>
    <div class="clear"></div>
    <%if (Model.Product != null)
      { %>
    <% Html.RenderAction("LatestComments", new { id = Model.Product.ID, number = 20 }); %>
    <% Html.RenderAction("Comment", new { id = Model.Product.ID }); %>
    <%} %>
    <div class="clear"></div>
    <% Html.RenderAction("OtherItems", "Deal", new { id = Model.Product.ID, number = 12, title = "Sản phẩm giảm giá khác liên quan" }); %>
 </div>   
    
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="PathContent" runat="server">
<% Html.RenderPartial("~/Views/Deal/Path.ascx", Model.DealIndexModel); %>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="RightContent" runat="server">
<% Html.RenderPartial("~/Views/Deal/Right.ascx", Model.DealIndexModel); %>
</asp:Content>
